﻿<!DOCTYPE html>
<html >
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>
    学生信息管理平台
</title>
    <link href="../../Style/StudentStyle.css" rel="stylesheet" type="text/css" />
    <link href="../../Script/jBox/Skins/Blue/jbox.css" rel="stylesheet" type="text/css" />
    <link href="../../Style/ks.css" rel="stylesheet" type="text/css" />
    <link href="../../css/mine.css" type="text/css" rel="stylesheet">
    <script src="../../Script/jBox/jquery-1.4.2.min.js" type="text/javascript"></script>
    <script src="../../Script/jBox/jquery.jBox-2.3.min.js" type="text/javascript"></script>
    <script src="../../Script/jBox/i18n/jquery.jBox-zh-CN.js" type="text/javascript"></script>
    <script src="../../Script/Common.js" type="text/javascript"></script>
    <script src="../../Script/Data.js" type="text/javascript"></script>
    <script src="/Script/jquery-1.4.1.js"></script>


</head>
<body>

<div class="div_head">
            <span>
                <span style="float:left">当前位置是：教务中心-》学生管理-》新增</span>
                <span style="float:right;margin-right: 8px;font-weight: bold"></span>
            </span>
</div>
</div>
<div class="cztable">
    <form action="" method="post" id="myForm">
        <table border="1" width="100%" class="table_a">
            <tr  width="120px;">
                <td width="10%">学号<span style="color:red">*</span>：</td>
                <td>
                    <input type="text" id="stuNo" name="stuNo" value="" />
                    <span id="mySpan"></span>
                </td>
            </tr>
            <tr  width="120px;">
                <td>姓名<span style="color:red">*</span>：</td>
                <td>
                    <input type="text"  name="stuName" value="杨XX" />
                </td>
            </tr>

            <tr>
                <td>年级<span style="color:red">*</span>：</td>
                <td id="selectId">
                    <select  name="gid">
                        <option value="-1">请选择</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>性别<span style="color:red">*</span>：</td>
                <td>
                    <input type="radio" name="sex" checked value="1" />男
                    <input type="radio" name="sex" value="0"/>女
                </td>
            </tr>


            <tr>
                <td>EMAIL：</td>
                <td>
                    <input type="text" name="email" value="1332@126.com" />
                </td>
            </tr>

            <tr>
                <td>联系电话：</td>
                <td>
                    <input type="text" name="phone" value="13333333333" />
                </td>
            </tr>

            <tr>
                <td>户口所在地：</td>
                <td>
                    <input type="text" name="registered" value="北京"  />
                </td>
            </tr>

            <tr>
                <td>住址：</td>
                <td>
                    <input type="text" name="address" value="朝阳" />
                </td>
            </tr>
            <tr>
                <td>政治面貌：</td>
                <td>
                    <input type="text" name="politics" value="党员" />
                </td>
            </tr>
            <tr>
                <td>身份证号：</td>
                <td>
                    <input type="text" name="idNumber" value="110111111111111" />
                </td>
            </tr>

            <tr>
                <td>专业：</td>
                <td>
                    <input type="text" name="profession" value="java" />
                </td>
            </tr>


            <tr>
                <td>简介<span style="color:red">*</span>：</td>
                <td>
                    <textarea name="introduction">一个新开辟领域的探讨，探讨摸索</textarea>
                </td>
            </tr>
            <tr>
                <td colspan=2 align="center">
                    <input type="button" id="addStudent" value="添加" />
                </td>
            </tr>
        </table>
    </form>
</div>

</div>
</div>
</div>
</body>
</html>
<script>
    $(function () {
        $.ajax({
            type: "GET",
            url: "/grade/list",
            data: "",
            dataType: "json",
            success: function (vo) {
                let list = vo.list;
                let str = " <select  name=\"gid\">";
                for (let i = 0; i < list.length; i++) {
                    let gradeId=list[i].gradeId;
                    let gradeName=list[i].gradeName;
                    str+="<option value=\""+gradeId+"\">"+gradeName+"</option>"
                }
                str+="</select>";
                $("#selectId").html(str);
            }
        });
        $("#addStudent").click(function () {
           // alert($("#myForm").serialize());
            $.ajax({
                type: "POST",
                url: "/student/",
                data: $("#myForm").serialize(),
                dataType: "json",
                success: function (vo) {
                    if(vo.code==200) {
                        alert("添加成功");
                        window.location.href = "/Educational/student/list.html";
                    }else{
                        alert(vo.msg);
                    }
                }
            });
        });
        /*$("#stuNo").blur(function(){
            var val = $("#stuNo").val();
            $.get("/validateStuNo","stuNo="+val,function(text){
                $("#mySpan").html(text);
            });
        });*/

    });
</script>